<template>
  <div class="manageIndex">
    <!-- 统计数据 -->
    <el-row :gutter="20">
      <el-col :span="6">
        <div class="grid-content bg-purple">
          <el-row :gutter="20" style="text-align: center">
            <el-col :span="8"><span class="el-icon-s-grid icon"></span></el-col>
            <el-col :span="16" class="info">
              <span>Dollar Profit Today</span>
              <h4>$ 23,232</h4>
            </el-col>
          </el-row>
        </div>
      </el-col>
      <el-col :span="6"
        ><div class="grid-content bg-purple">
          <el-row :gutter="20" style="text-align: center">
            <el-col :span="8"
              ><span class="el-icon-document icon"></span
            ></el-col>
            <el-col :span="16" class="info">
              <span>Dollar Profit Today</span>
              <h4>$ 23,232</h4>
            </el-col>
          </el-row>
        </div>
      </el-col>
      <el-col :span="6"
        ><div class="grid-content bg-purple">
          <el-row :gutter="20" style="text-align: center">
            <el-col :span="8"
              ><span class="el-icon-position icon"></span
            ></el-col>
            <el-col :span="16" class="info">
              <span>Dollar Profit Today</span>
              <h4>$ 23,232</h4>
            </el-col>
          </el-row>
        </div>
      </el-col>
      <el-col :span="6"
        ><div class="grid-content bg-purple">
          <el-row :gutter="20" style="text-align: center">
            <el-col :span="8"
              ><span class="el-icon-shopping-bag-2 icon"></span
            ></el-col>
            <el-col :span="16" class="info">
              <span>Dollar Profit Today</span>
              <h4>$ 23,232</h4>
            </el-col>
          </el-row>
        </div>
      </el-col>
    </el-row>
    <div class="chars">
      <p class="sale">销售量排行榜</p>
      <div id="main"></div>
      <p class="rigthInfo">商品信息</p>
      <div id="right"></div>
    </div>
    <div>这个页面纯属就是好看凑页面的</div>
  </div>
</template>
<script>
export default {
  name: "index",
  data() {
    return {};
  },
  created() {},
  mounted() {
    this.one();
    this.two();
  },
  methods: {
    one() {
      var myChart = this.$echarts.init(document.getElementById("main"));
      // 指定图表的配置项和数据
      var option = {
        backgroundColor: "#fcfcfd",
        tooltip: {},
        legend: {
          data: ["销量"],
          top:'10px'
        },
        xAxis: {
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
        },
        yAxis: {},
        series: [
          {
            name: "销量",
            type: "bar",
            data: [5, 20, 36, 10, 10, 20],
          },
        ],
      };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    },
    two() {
      var myChart = this.$echarts.init(document.getElementById("right"));
      var option = {
        backgroundColor: "#fcfcfd",

        title: {
          text: "Customized Pie",
          left: "center",
          top: 20,
          textStyle: {
            color: "black",
          },
        },

        tooltip: {
          trigger: "item",
        },

        visualMap: {
          show: false,
          min: 80,
          max: 600,
          inRange: {
            colorLightness: [0, 1],
          },
        },
        series: [
          {
            name: "访问来源",
            type: "pie",
            radius: "55%",
            center: ["50%", "50%"],
            data: [
              { value: 335, name: "直接访问" },
              { value: 310, name: "邮件营销" },
              { value: 274, name: "联盟广告" },
              { value: 235, name: "视频广告" },
              { value: 400, name: "搜索引擎" },
            ].sort(function (a, b) {
              return a.value - b.value;
            }),
            roseType: "radius",
            label: {
              color: "black",
            },
            labelLine: {
              lineStyle: {
                color: "black",
              },
              smooth: 0.2,
              length: 10,
              length2: 20,
            },
            itemStyle: {
              color: "#c23531",
              shadowBlur: 200,
              shadowColor: "rgba(0, 0, 0, 0.5)",
            },

            animationType: "scale",
            animationEasing: "elasticOut",
            animationDelay: function () {
              return Math.random() * 200;
            },
          },
        ],
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    },
  },
};
</script>
<style lang="less">
.manageIndex {
  height: 100%;
  .chars {
    position: relative;
    background: white;
    border-radius: 5px;
    height: 430px;
    margin-top: 20px;
    .sale {
      color: rgba(44, 42, 42, 0.432);
      position: relative;
      top: 40px;
      left: 240px;
      font-size: 16px;
      font-weight: bold;
      display: inline;
    }
    #main {
      padding-top: 20px;
      margin-top: 40px;
      width: 600px;
      height: 300px;
    }
    .rigthInfo{
      position: absolute;
      z-index: 10;
      top: 20px;
      right: 285px;
      font-size: 16px;
      font-weight: bold;
      display: inline;
      color: rgba(44, 42, 42, 0.432);
    }
    #right{
      position: absolute;
      top: 70px;
      right: 20px;
      width: 600px;
      height: 300px;
    }
  }
  .el-row {
    .el-col:nth-child(1) > div {
      background: #fc8675;
    }
    .el-col:nth-child(2) > div {
      background: #5ab6df;
    }
    .el-col:nth-child(3) > div {
      background: #65cea7;
    }
    .el-col:nth-child(4) > div {
      background: #ebc85e;
    }
  }
  .bg-purple {
    padding: 15px;
    height: 60px;
    border-radius: 5px;
    .info {
      margin-top: 10px;
      color: white;
      line-height: 20px;
      font-size: 17px;
      span {
        line-height: 20px;
      }
      h4 {
        margin: 0;
        margin-top: 10px;
      }
    }
    .icon {
      margin-top: 0px;
      font-size: 60px;
      color: white;
    }
  }
  .bg-purple > .el-row {
    line-height: 70px;
  }
}
</style>